#pragma strict

var cam:Camera;
var fov:float = 10;
var fovScrollSpeed:float = 10;

private var lastFov:float;
static var isAim:boolean;

function Start () {
	cam = Camera.main;
	lastFov = cam.fieldOfView;
	// Screen.showCursor = false;
	// Screen.lockCursor = true;
}

function Update () {
	fov -= Input.GetAxis("Mouse ScrollWheel") * Time.deltaTime * fovScrollSpeed;
	if(Input.GetMouseButtonDown(1)){
		isAim = !isAim;
	}
	
	if(isAim){
		cam.fieldOfView = fov;
	}else{
		cam.fieldOfView = lastFov;
	}
}